package main

import (
	"fmt"
	"net/http"
)

func handle(w http.ResponseWriter,r *http.Request){
	fmt.Fprintf(w,"Hi there, I love %s!",r.URL.Path[1:])
	fmt.Println("Request received for:",r.URL.Path)
}

func aboutHandle(w http.ResponseWriter,r *http.Request){
	fmt.Fprintf(w, "This is the about page.")
	fmt.Println("Request received for: /about")
}


func main(){

	// bound handle to route
	http.HandleFunc("/",handle)
	http.HandleFunc("/about",aboutHandle)

	fmt.Println("server strating on port 8080...")

	if err:=http.ListenAndServe(":8080",nil);err != nil{
		fmt.Println("http listenAndServer err:",err)
		return
	}
	fmt.Println("Server stopped.")
}